package com.sun.tv;

import java.util.ArrayList;

public class ContentType {

	public static final String IMAGE_TYPE[] = { "jpg", "jpeg", "gif", "png" };
	public static final String AUDIO_TYPE[] = { "aac", "amr", "imelody", "mid",
			"midi", "mp3", "mpeg3", "mpg", "mp4", "x-mid", "ogg" };
	public static final String VIDEO_TYPE[] = { "3gp", "mp4", "asf", "flv",
			"avi", "mpeg", "mpg", "mov", "ogg", "rm", "rmvb", "mkv", "qt",
			"dat", "vob", "3g2", "wmv", "wmvhd" };
	public static final String INSTALL_TYPE = "apk";/*------ ran.huang 2012-12-10 下午3:14:33 add start ------*/
	public static final String ZIP = "zip";

	public static final String HTML_ZIP = "html.zip";
	public static final String LOCALWAP_IMAGE_ZIP = "localwapimage.zip";
	public static final String LOCALWAP_HTML_ZIP = "localwaphtml.zip";
	private static final ArrayList<String> sImageTypes = new ArrayList<String>();
	private static final ArrayList<String> sAudioTypes = new ArrayList<String>();
	private static final ArrayList<String> sVideoTypes = new ArrayList<String>();
	private static final ArrayList<String> sZipTypes = new ArrayList<String>();

	static {
		for (int i = 0; i < IMAGE_TYPE.length; i++) {
			sImageTypes.add(IMAGE_TYPE[i]);
		}
		for (int i = 0; i < AUDIO_TYPE.length; i++) {
			sAudioTypes.add(AUDIO_TYPE[i]);
		}
		for (int i = 0; i < VIDEO_TYPE.length; i++) {
			sVideoTypes.add(VIDEO_TYPE[i]);
		}
		sZipTypes.add(ZIP);
		sZipTypes.add(HTML_ZIP);
	}

	// This class should never be instantiated.
	private ContentType() {
	}

	/*------ ran.huang 2012-12-10 下午3:14:51 add start ------*/
	public static boolean isInstallpak(String contentType) {
		return (null != contentType) && contentType.equals(INSTALL_TYPE);
	}

	/*------ ran.huang 2012-12-10 下午3:14:56 add end ------*/
	public static boolean isImageType(String contentType) {
		return (null != contentType) && sImageTypes.contains(contentType);
	}

	public static boolean isAudioTypes(String contentType) {
		return (null != contentType) && sAudioTypes.contains(contentType);
	}

	public static boolean isVideoTypes(String contentType) {
		return (null != contentType) && sVideoTypes.contains(contentType);
	}

	public static boolean isZipTypes(String contentType) {
		return (null != contentType) && sZipTypes.contains(contentType);
	}

}
